package top.xphu.aliyun.orc;


import org.apache.commons.lang.StringUtils;
import top.xphu.aliyun.orc.exception.AppCodeEmptyException;

/**
 * @author xphu
 * @version 1.0
 * @date 2021/9/6 16:52
 */
public class OrcCore {
    private OrcProperties properties;
    public static OrcCore builder(){
        return new OrcCore();
    }

    public OrcCore appcode(String appcode){
        properties = new OrcProperties(appcode);
        return this;
    }

    public OrcTools build(){
        if (StringUtils.isEmpty(properties.getAppcode())) {
           throw  new AppCodeEmptyException("AppCode is Not Empty!");
        }
        return new OrcTools(this);
    }

    public OrcProperties getProperties() {
        return properties;
    }

    //    /**
//     * 初始化配置文件
//     */
//    public void init(){
//        ClassPathResource resource = new ClassPathResource("test.properties");
//        properties = new Properties();
//        try {
//            properties.load(resource.getStream());
//        } catch (IOException e){
//            e.printStackTrace();
//        }
//        Console.log("Properties: {}", properties);
//    }

}
